<template>
  <div class="pay-success">
    <Header />
    <div class="main-container">
      <div class="success-content">
        <div class="success-icon">
          <i class="fas fa-check-circle"></i>
        </div>
        <h2 class="success-title">您已成功购买 1 门课程!</h2>
        <p class="success-subtitle">您可以加入QQ群 <span class="qq-group">74755603</span> 学习交流</p>

        <div class="order-info">
          <div class="info-item">
            <span class="label">付款时间：</span>
            <span class="value">{{ orderTime }}</span>
          </div>
          <div class="info-item">
            <span class="label">付款金额：</span>
            <span class="value">¥{{ orderAmount }}</span>
          </div>
          <div class="info-item">
            <span class="label">课程信息：</span>
            <span class="value">《{{ courseName }}》</span>
          </div>
        </div>

        <div class="qr-code-section">
          <div class="qr-code">
            <img src="https://b0.bdstatic.com/8595d998d639e54522c1cac53f19e189.jpeg@h_1280" alt="微信扫码关注" class="qr-image">
          </div>
          <div class="qr-tip">
            <i class="fas fa-exclamation-circle"></i>
            重要！微信扫码关注获得学习通知及课程更新提醒！否则严重影响学习和课程体验！
          </div>
        </div>

        <div class="action-buttons">
          <button class="primary-btn" @click="goToStudy">立即学习</button>
        </div>
      </div>
    </div>
  </div>
</template>

<script setup>
import { ref } from 'vue'
import { useRouter, useRoute } from 'vue-router'
import Header from '../components/Header.vue'

const router = useRouter()
const route = useRoute()

const orderTime = ref('2019/03/21 11:17')
const orderAmount = ref('0')
const courseName = ref('Windows下双版本Python环境安装')

const goToStudy = () => {
  router.push(`/course-study`)  // 使用路由路径格式
}
</script>

<style scoped>
.pay-success {
  min-height: 100vh;
  background: #f5f5f5;
}

.main-container {
  width: 100%;
  padding-top: 60px;
  min-height: calc(100vh - 60px);
  display: flex;
  align-items: center;
  justify-content: center;
}

.success-content {
  background: white;
  padding: 40px;
  border-radius: 8px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
  width: 100%;
  max-width: 600px;
  margin: 20px;
}

.success-icon {
  width: 72px;
  height: 72px;
  background: #f6ffed;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 24px;
}

.success-icon i {
  font-size: 36px;
  color: #52c41a;
}

.success-title {
  font-size: 24px;
  color: #333;
  margin: 0 0 12px;
}

.success-subtitle {
  font-size: 16px;
  color: #666;
  margin: 0 0 32px;
}

.qq-group {
  color: #1890ff;
  font-weight: bold;
}

.order-info {
  background: #fafafa;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 32px;
}

.info-item {
  display: flex;
  margin-bottom: 16px;
  font-size: 14px;
  line-height: 1.5;
}

.info-item:last-child {
  margin-bottom: 0;
}

.info-item .label {
  color: #666;
  width: 80px;
  flex-shrink: 0;
}

.info-item .value {
  color: #333;
  flex: 1;
}

.qr-code-section {
  display: flex;
  gap: 24px;
  align-items: center;
  background: #fffbe6;
  border-radius: 8px;
  padding: 24px;
  margin-bottom: 32px;
}

.qr-code {
  flex-shrink: 0;
}

.qr-image {
  width: 120px;
  height: 120px;
  border-radius: 4px;
}

.qr-tip {
  flex: 1;
  font-size: 14px;
  color: #d48806;
  display: flex;
  align-items: center;
  gap: 8px;
}

.qr-tip i {
  font-size: 20px;
}

.action-buttons {
  display: flex;
  justify-content: center;
}

.primary-btn {
  padding: 12px 48px;
  border: none;
  border-radius: 4px;
  background: #ff6b00;
  color: white;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s;
}

.primary-btn:hover {
  background: #ff8533;
}
</style> 